package cate.game.pvp.minecraft;

import cate.common.table.common.CommonExcel;
import cate.common.table.d.GDParamTool;
import cate.common.util.TimeTool;
import easy.java.dev.note.NoteField;
import lombok.experimental.UtilityClass;

@UtilityClass
public final class MinecraftConstants {
    @NoteField("玩法每周关闭时间-分钟")
    public static long MINECRAFT_WEEKLY_CLOSE_MINUTES = 60;
    @NoteField("最大占领数量")
    public static int MAX_HOLDING_POINT_NUM = 3;
    @NoteField("最大进攻次数")
    public static int MAX_FIGHT_NUM = 12;
    @NoteField("功能开启初始进攻次数")
    public static int INIT_FIGHT_NUM = 5;
    @NoteField("进攻次数获得间隔")
    public static int FIGHT_ADD_INTERVAL_MINUTE = 120;
    @NoteField("跨天获得进攻次数")
    public static int FIGHT_ADD_DAILY = 3;
    @NoteField("保护道具消耗")
    public static String PROTECT_COST_STR = "3:206012:1";
    @NoteField("添加进攻次数道具消耗")
    public static String FIGHT_ADD_COST_STR = "3:206011:1";
    @NoteField("单次保护时长")
    public static int PROTECT_HOUR = 2;
    @NoteField("每日保护次数上下")
    public static int PROTECT_DAILY_MAX = 5;
    @NoteField("抢占矿点后的静默期")
    public static long POINT_LOCK_TIME_MS = 5 * TimeTool.TimeCons.MINUTE;

    @NoteField("战斗超时时间")
    public final static int FIGHT_TIMEOUT_SECONDS = 20 * 60;

    /**
     * 从配置中读取常量
     *
     * @param common 通用配置
     */
    public static void loadFromTable(CommonExcel common) {
        // 策划配常量表
        MINECRAFT_WEEKLY_CLOSE_MINUTES = GDParamTool.getLong(common.param, 2001, MINECRAFT_WEEKLY_CLOSE_MINUTES);
        MAX_HOLDING_POINT_NUM = GDParamTool.getInt(common.param, 2002, MAX_HOLDING_POINT_NUM);
        MAX_FIGHT_NUM = GDParamTool.getInt(common.param, 2003, MAX_FIGHT_NUM);
        INIT_FIGHT_NUM = GDParamTool.getInt(common.param, 2004, INIT_FIGHT_NUM);
        FIGHT_ADD_INTERVAL_MINUTE = GDParamTool.getInt(common.param, 2005, FIGHT_ADD_INTERVAL_MINUTE);
        FIGHT_ADD_DAILY = GDParamTool.getInt(common.param, 2006, FIGHT_ADD_DAILY);
        PROTECT_COST_STR = GDParamTool.getString(common.param, 2007, PROTECT_COST_STR);
        FIGHT_ADD_COST_STR = GDParamTool.getString(common.param, 2008, FIGHT_ADD_COST_STR);
        PROTECT_HOUR = GDParamTool.getInt(common.param, 2009, PROTECT_HOUR);
        PROTECT_DAILY_MAX = GDParamTool.getInt(common.param, 2010, PROTECT_DAILY_MAX);
        POINT_LOCK_TIME_MS = GDParamTool.getLong(common.param, 2013, POINT_LOCK_TIME_MS);
    }
}
